package com.example.photo.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

@Configuration
@Profile("dev")
@EnableSwagger2WebMvc
public class Knife4jConfig {
    @Bean(value = "dockerBean")
    public Docket dockerBean() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(new ApiInfoBuilder()
                        .description("# Photo APIs")
                        .build())
                .groupName("方寸流年")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.example.photo.controller"))
                .paths(PathSelectors.any())
                .build();
    }
}